import 'package:course_control/gen/assets.gen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_utils/flutter_utils.dart';
import 'package:flutter_widgets/flutter_widgets.dart';

class BackgroundWidget extends StatelessWidget {
  final Widget child;
  final String? bgString;

  BackgroundWidget({
    super.key,
    required this.child,
  }) : bgString = Assets.images.bg.path;
  const BackgroundWidget.bgString(
      {super.key, required this.child, required this.bgString});

  @override
  Widget build(BuildContext context) {
    return Stack(
      fit: StackFit.expand,
      children: [
        Positioned.fill(
          child: CommonImage.asset(
            Assets.images.bg.path,
            fit: BoxFit.fill,
          ),
        ),
        Positioned(
          left: 26.ratio,
          top: MediaQuery.of(context).padding.top,
          child: CommonImage.asset(
            Assets.images.logo.path,
            width: 82.ratio,
          ),
        ),
        Center(
          child: Padding(
            padding: EdgeInsets.only(
                top: MediaQuery.of(context).padding.top + 10.ratio),
            child: child,
          ),
        ),
      ],
    );
  }
}
